\(\int \cos (c+d x) (a+b \tan (c+d x)) \, dx\) [513]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 17, antiderivative size = 24 \[ \int \cos (c+d x) (a+b \tan (c+d x)) \, dx=-\frac {b \cos (c+d x)}{d}+\frac {a \sin (c+d x)}{d} \]

[Out]

-b*cos(d*x+c)/d+a*sin(d*x+c)/d

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {3567, 2717} \[ \int \cos (c+d x) (a+b \tan (c+d x)) \, dx=\frac {a \sin (c+d x)}{d}-\frac {b \cos (c+d x)}{d} \]

[In]

Int[Cos[c + d*x]*(a + b*Tan[c + d*x]),x]

[Out]

-((b*Cos[c + d*x])/d) + (a*Sin[c + d*x])/d

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3567

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*((d*Sec[
e + f*x])^m/(f*m)), x] + Dist[a, Int[(d*Sec[e + f*x])^m, x], x] /; FreeQ[{a, b, d, e, f, m}, x] && (IntegerQ[2
*m] || NeQ[a^2 + b^2, 0])

Rubi steps \begin{align*} \text {integral}& = -\frac {b \cos (c+d x)}{d}+a \int \cos (c+d x) \, dx \\ & = -\frac {b \cos (c+d x)}{d}+\frac {a \sin (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.92 \[ \int \cos (c+d x) (a+b \tan (c+d x)) \, dx=-\frac {b \cos (c) \cos (d x)}{d}+\frac {a \cos (d x) \sin (c)}{d}+\frac {a \cos (c) \sin (d x)}{d}+\frac {b \sin (c) \sin (d x)}{d} \]

[In]

Integrate[Cos[c + d*x]*(a + b*Tan[c + d*x]),x]

[Out]

-((b*Cos[c]*Cos[d*x])/d) + (a*Cos[d*x]*Sin[c])/d + (a*Cos[c]*Sin[d*x])/d + (b*Sin[c]*Sin[d*x])/d

Maple [A] (verified)

Time = 0.72 (sec) , antiderivative size = 23, normalized size of antiderivative = 0.96

method result size
derivativedivides \(\frac {-b \cos \left (d x +c \right )+a \sin \left (d x +c \right )}{d}\) \(23\)
default \(\frac {-b \cos \left (d x +c \right )+a \sin \left (d x +c \right )}{d}\) \(23\)
risch \(-\frac {b \cos \left (d x +c \right )}{d}+\frac {a \sin \left (d x +c \right )}{d}\) \(25\)

[In]

int(cos(d*x+c)*(a+b*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(-b*cos(d*x+c)+a*sin(d*x+c))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 23, normalized size of antiderivative = 0.96 \[ \int \cos (c+d x) (a+b \tan (c+d x)) \, dx=-\frac {b \cos \left (d x + c\right ) - a \sin \left (d x + c\right )}{d} \]

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

-(b*cos(d*x + c) - a*sin(d*x + c))/d

Sympy [F]

\[ \int \cos (c+d x) (a+b \tan (c+d x)) \, dx=\int \left (a + b \tan {\left (c + d x \right )}\right ) \cos {\left (c + d x \right )}\, dx \]

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)),x)

[Out]

Integral((a + b*tan(c + d*x))*cos(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 23, normalized size of antiderivative = 0.96 \[ \int \cos (c+d x) (a+b \tan (c+d x)) \, dx=-\frac {b \cos \left (d x + c\right ) - a \sin \left (d x + c\right )}{d} \]

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

-(b*cos(d*x + c) - a*sin(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 129 vs. \(2 (24) = 48\).

Time = 0.36 (sec) , antiderivative size = 129, normalized size of antiderivative = 5.38 \[ \int \cos (c+d x) (a+b \tan (c+d x)) \, dx=-\frac {b \tan \left (\frac {1}{2} \, d x\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + 2 \, a \tan \left (\frac {1}{2} \, d x\right )^{2} \tan \left (\frac {1}{2} \, c\right ) + 2 \, a \tan \left (\frac {1}{2} \, d x\right ) \tan \left (\frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x\right )^{2} - 4 \, b \tan \left (\frac {1}{2} \, d x\right ) \tan \left (\frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, c\right )^{2} - 2 \, a \tan \left (\frac {1}{2} \, d x\right ) - 2 \, a \tan \left (\frac {1}{2} \, c\right ) + b}{d \tan \left (\frac {1}{2} \, d x\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + d \tan \left (\frac {1}{2} \, d x\right )^{2} + d \tan \left (\frac {1}{2} \, c\right )^{2} + d} \]

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)),x, algorithm="giac")

[Out]

-(b*tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*a*tan(1/2*d*x)^2*tan(1/2*c) + 2*a*tan(1/2*d*x)*tan(1/2*c)^2 - b*tan(1/2*d*
x)^2 - 4*b*tan(1/2*d*x)*tan(1/2*c) - b*tan(1/2*c)^2 - 2*a*tan(1/2*d*x) - 2*a*tan(1/2*c) + b)/(d*tan(1/2*d*x)^2
*tan(1/2*c)^2 + d*tan(1/2*d*x)^2 + d*tan(1/2*c)^2 + d)

Mupad [B] (verification not implemented)

Time = 4.21 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.58 \[ \int \cos (c+d x) (a+b \tan (c+d x)) \, dx=-\frac {2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (b\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )-a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d} \]

[In]

int(cos(c + d*x)*(a + b*tan(c + d*x)),x)

[Out]

-(2*cos(c/2 + (d*x)/2)*(b*cos(c/2 + (d*x)/2) - a*sin(c/2 + (d*x)/2)))/d